<template>
	<view>
		<!-- 轮播图 -->
		<view class="u-demo-area">
			<u-toast ref="uToast"></u-toast>
			<u-swiper @change1="change" :height="350" :list="list" :title="title" :effect3d="effect3d" :indicator-pos="indicatorPos"
			 :mode="mode" :interval="3000" @click="click1"></u-swiper>
		</view>
		
		<view class="newstop">
			<u-row>
				<u-col span="3">
					<p style="font-size: 35rpx;margin-top: 15rpx;font-weight: 700;">最新资讯</p>
				</u-col>
				<u-col style="float: right;">
					<p style="float: right;margin-top: 20rpx;" @click="gonewslist()">更多分类></p>
				</u-col>
			</u-row>
		</view>
		
		<view>
			<scroll-view scroll-y style="width: 100%;" @scrolltolower="onreachBottom">
				<view class="item">
					<view class="wrap">
						<u-row gutter="16" justify="space-between" v-for="(item,i) in news">
							<u-col span="3" @click="gonews(item.id)">
								<img :src="item.safetyPublicityPic" mode="aspectFill" style="width: 200rpx;height: 200rpx;"></img>
							</u-col>
							<u-col span="9" @click="gonews(item.id)">
								<view class="newsname">{{ item.safetyPublicityTitle }}</view>
								<view class="newstime">{{ item.setDate }}</view>
							</u-col>
						</u-row>
					</view>
				</view>
			</scroll-view>
		</view>



	</view>
</template>

<script>
	export default {
		data() {
			return {
				/* 轮播图 */
				list: [{
						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
						title: '昨夜星辰昨夜风，画楼西畔桂堂东'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
						title: '身无彩凤双飞翼，心有灵犀一点通'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
						title: '谁念西风独自凉，萧萧黄叶闭疏窗，沉思往事立残阳'
					}
				],
				title: false,
				mode: 'round',
				indicatorPos: 'bottomCenter',
				effect3d: true,
				/* 数据 */
				news: [],
				
				current: 0,
				swiperCurrent: 0,
				tabsHeight: 0,
				dx: 0,
				loadStatus: ['loadmore', 'loadmore', 'loadmore', 'loadmore'],
			}
		},
		onLoad() {
			this.$u.api.selectrecommend({recommendPage:"2"}).then(res => {
				this.list=res.rows;
				console.log(this.recommend.rows);
			})
		},
		computed: {},
		onShow() {
			//获取维修任务列表
			// this.$u.get('http://192.168.1.178:8080/mobile/repairmisson')
			// 	.then(res => {
			// 		this.repairwork = res.data.length;
			// 	}).catch(res => {
			// 		console.log("获取失败");
			// 	})
		},
		created() {
			this.$u.api.selectpublictime({
				
			}).then(res => {
				this.news=res.rows;
				console.log(this.news);
			})

		},
		methods: {
			openPage(path) {
				this.$u.route({
					url: path
				})
			},
			
			gonews(num) {
				uni.navigateTo({
					url:'/pages/propaganda/content?newsNumber=' + num,
				})
			},
			gonewslist(){
				uni.navigateTo({
					url:'/pages/propaganda/classification'
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.item {
		margin: 30rpx 0;
	}

	.grid-text {
		font-size: 28rpx;
		margin-top: 4rpx;
		color: $u-type-info;
	}

	/* 数据 */
	.order {
		width: 710rpx;
		background-color: #ffffff;
		margin: 20rpx auto;
		border-radius: 20rpx;
		box-sizing: border-box;
		padding: 20rpx;
		font-size: 28rpx;

		.item {
			display: flex;
			margin: 20rpx 0 0;

			.left {
				margin-right: 20rpx;

				image {
					width: 200rpx;
					height: 200rpx;
					border-radius: 10rpx;
				}
			}

			.content {
				.title {
					font-size: 28rpx;
					line-height: 50rpx;
				}

				.type {
					margin: 10rpx 0;
					font-size: 24rpx;
					color: $u-tips-color;
				}

				.delivery-time {
					color: #e5d001;
					font-size: 24rpx;
				}
			}

			.right {
				margin-left: 10rpx;
				padding-top: 20rpx;
				text-align: right;

				.decimal {
					font-size: 24rpx;
					margin-top: 4rpx;
				}

				.number {
					color: $u-tips-color;
					font-size: 24rpx;
				}
			}
		}

		.total {
			margin-top: 20rpx;
			text-align: right;
			font-size: 24rpx;

			.total-price {
				font-size: 32rpx;
			}
		}

		.bottom {
			display: flex;
			margin-top: 40rpx;
			padding: 0 10rpx;
			justify-content: space-between;
			align-items: center;

			.btn {
				line-height: 52rpx;
				width: 160rpx;
				border-radius: 26rpx;
				border: 2rpx solid $u-border-color;
				font-size: 26rpx;
				text-align: center;
				color: $u-type-info-dark;
			}

			.evaluate {
				color: $u-type-warning-dark;
				border-color: $u-type-warning-dark;
			}
		}
	}

	.centre {
		text-align: center;
		margin: 200rpx auto;
		font-size: 32rpx;

		image {
			width: 164rpx;
			height: 164rpx;
			border-radius: 50%;
			margin-bottom: 20rpx;
		}

		.tips {
			font-size: 24rpx;
			color: #999999;
			margin-top: 20rpx;
		}

		.btn {
			margin: 80rpx auto;
			width: 200rpx;
			border-radius: 32rpx;
			line-height: 64rpx;
			color: #ffffff;
			font-size: 26rpx;
			background: linear-gradient(270deg, rgba(249, 116, 90, 1) 0%, rgba(255, 158, 1, 1) 100%);
		}
	}

	.wrap {
		/* display: flex; */
		flex-direction: column;
		height: calc(100vh - var(--window-top));
		width: 100%;
	}

	.swiper-box {
		flex: 1;
	}

	.swiper-item {
		height: 100%;
	}

	/* 数据 */

	.u-row {
		margin: 40rpx 0;
	}

	.demo-layout {
		height: 80rpx;
		border-radius: 8rpx;
	}

	.bg-purple {
		background: #d3dce6;
	}

	.bg-purple-light {
		background: #e5e9f2;
	}

	.bg-purple-dark {
		background: #99a9bf;
	}

	.newsname {
		font-size: 35rpx;
		margin-top: 30rpx;
		margin-left: 50rpx;
		font-weight: 700;
	}

	.newstime {
		font-size: 30rpx;
		margin-top: 30rpx;
		margin-left: 50rpx;
		color: #7f7f93;
	}
	
	.newstop{
		border: 1px solid #dde3ed;
		height: 80rpx;
	}
</style>
